home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / rayl120.zip / RAYLATHE.DOC < prev    next >
Text File  |  1993-04-24  |  8KB  |  188 lines

  1.  
  2.  
  3.  
  4.     RayLathe v 1.20 (c) 1993 Koehler
  5.  
  6.     DESCRIPTION:
  7.  
  8.      RayLathe is a text based tool that allows you to create three
  9.     dimensional objects using the metaphor of the carpenter's lathe.  The
  10.     objects are created as #declare'd composite's for POVRAY 1.0 (p.k.a.
  11.     DKB) or Vivid 2.0 ray tracing programs.
  12.  
  13.      The data is given as X, Y, THICK.  X and Y are the coordinates of
  14.     the end point of the line of a cut on the lathe.  THICK is the
  15.     thickness of the surface of the object.  This obviously differs from a
  16.     real lathe were the object is solid.  We can, however, do things a real
  17.     lathe can't:  undercut an area.  See example #2 below.  The values for
  18.     THICK are:    -1 for POVRAY=solid / Vivid=paper-thing object (renders
  19.     quickest, no undercutting allowed in POVRAY), 0 for 'move to' (like
  20.     starting a new block of wood a distance from the current one), and
  21.     anything greater than 0 for the actual thickness of the shell of the
  22.     object.  The last entry must be '-1 -1 -1' to signify end of object.
  23.     Comments may be added after the '-1 -1 -1' line.
  24.  
  25.  
  26.     EXAMPLE #1
  27.  
  28.      We will make an object that looks like a pulley.  Figure A shows
  29.     the coordinates with lines showing the cut surface.  Figure B is the
  30.     data set for Figure A.  Figure C is a view of the pulley looking into
  31.     the groove.
  32.  
  33.        Fig. A           Fig. B             Fig. C
  34.  
  35.     5 |   *      *           2 1 0  <-note move-to    .    .
  36.     4 |   |\     /|           5 5 -1            |\     /|
  37.     3 |   | *---* |           3 3 -1            | .---. |
  38.     2 |   |      |           5 3 -1            |    |
  39.     1 |   *      *           6 5 -1            |    |
  40.       + - - - - - - - - -       6 1 -1            |    |
  41.     0    1 2 3 4 5 6 7 8 9       -1 -1 -1            | .---. |
  42.                                 |/     \|
  43.                                 .    .
  44.     EXAMPLE #2
  45.  
  46.      Contrary to a real lathe, this lathe can undercut surfaces.  For
  47.     example we can make something that looks [barely] like a sun umbrella.
  48.     Remember to use thickness when undercutting else the solid object will
  49.     fill in the inside of the umbrella.  Also, use a thickness of 0 when
  50.     moving from the tip of the umbrella (point 3) into the center (point 4)
  51.     when drawing the post (line between 4 and 5).
  52.  
  53.  
  54.  
  55.  
  56.        Fig. D                     Fig. E
  57.  
  58.  
  59.          3                      .
  60.            /                    / !
  61.         /                         /      !
  62.      /                      /      !
  63.       /                        /      !
  64.      2                          .       !
  65.      |4-----------------------------5          |-------------------------------
  66.      1                          |-------------------------------
  67.                           .       !
  68.                            \      !
  69.                           \      !
  70.                              \      !
  71.                             \ !
  72.                               .
  73.  
  74.  
  75.  
  76.     APPLICATION NOTES:
  77.  
  78.      Another program is included to convert uLathe (by Daniel S.  Baker
  79.     CompuServe:  71551,2300) .LAT files to .DAT files used by RayLathe to
  80.     generate the objects.  uLathe is an excellent object creator for
  81.     windows.  I was disappointed that the output was not usable by any of
  82.     the ray tracers for building whole scenes.    Ta-Da!    Hopefully RayLathe
  83.     code can be integrated as an export option for uLathe.
  84.  
  85.      The objects themselves are a series of cuts (the line between the
  86.     specified points of data).    uLathe presents each cut as a number of
  87.     flat facets about the X axis.  For ray tracing, multiply the number of
  88.     cuts by the number of facets.  Thats a lot.  I observed that any given
  89.     cut would acutally look like a cone (or cylinder if parallel).  This
  90.     reduces the number of objects tremdously and thus speeds ray tracing +
  91.     smoother about the X axis.    Unfortunately there is not much I can do
  92.     with sharp edges of the cuts.  The candle in particular doesn't seem to
  93.     suffer.  Be careful with curved surfaces.  I have kicked ideas around
  94.     about A) generating smooth triangles more like uLathe B) making curves
  95.     with tori.
  96.  
  97.      For POVRAY the texture LatheWorkTex must be defined for the
  98.     resulting object.  See the included example .POV file.  At the end of
  99.     the file created by RayLathe are two #declare's (Location and Look_At)
  100.     which are vector definitions for where to put the camera and where to
  101.     aim the camera.
  102.  
  103.     To use them in POVRAY:
  104.  
  105.     In steady of:   location <1 2 3>     you can use:    location Location
  106.             look_at <3 2 1>            look_at Look_At
  107.  
  108.  
  109.     Usage:   LAT2RAYL candle            <- Converts uLathe CANDLE.LAT
  110.          RAYLATHE <candle.dat >candle.inc    <- Creates candle POVRAY object
  111.          RAYLATHE -v <candle.dat >candle.vo <- Creates candle Vivid object
  112.          Then create the scene (.pov or .v) and render.
  113.  
  114.  
  115.  
  116.  
  117.     ADDITIONAL BOTHER:
  118.  
  119.      See also CHAIN (which generates a chain of links), SHADE (which
  120.     generates pleated lamp shades), DIAMOND (which generates a cut gem,
  121.     plus creates the rest of the .POV file:  view, light, floor), GEAR
  122.     (guess), STAR (which generates 3D stars with several attributes),
  123.     FNT2POV (which converts Grasp/Pictor/compatible fonts to objects using
  124.     many options), and SHP2DKB (which should become SHP2PV) which takes
  125.     AutoCad .SHP font files and generates stroke-type font objects.  At
  126.     this time all of the programs listed in this paragraph are for POVRAY
  127.     only.
  128.  
  129.      With all of these programs, just play around with the variables to
  130.     generate new shapes.  For example, generating many long points on the
  131.     star looks like the spokes of a bicycle wheel.  Many short points on a
  132.     large radius star looks like a circular saw blade.    Use your
  133.     imagination and please post any ideas or neat works (with source) for
  134.     the world to enjoy.  As you can tell I don't like building single
  135.     objects; I'd rather build a factory that can spit out 'what if' objects.
  136.  
  137.      Trial size soap box:  Please include source when sending programs
  138.     or objects.  Even if its sloppy, it can only help others.  Follow the
  139.     lead of the people who brought us DKB in the first place.  We wouldn't
  140.     have a POVRAY now otherwise!  Many thanks to those who do post!
  141.  
  142.     I can be reached at YOU CAN CALL ME RAY RBBS (708) 358-5611.
  143.  
  144.  
  145.             "Its my world and you're welcome to it".
  146.  
  147.  
  148.                         Ken Koehler (4-24-93)
  149.                         CIS 72740,1161
  150.  
  151.  
  152.  
  153.  
  154.     Enclosed are these files:
  155.  
  156.      RAYLATHE.C    C source
  157.      RAYLATHE.EXE  MS-DOS executable for object generator
  158.      RAYLATHE.DOC  This file
  159.      LAT2RAYL.C    C source
  160.      LAT2RAYL.EXE  uLathe .LAT to RayLathe .DAT converter
  161.      CANDLE.LAT    uLathe .LAT file containing shape data
  162.      CANDLE.POV    Sample POVRAY file to generate the test image
  163.      SNIFTER.LAT   uLathe .LAT file containing shape data
  164.      SNIFTER.V     Sample Vivid file to generate the test image
  165.  
  166.  
  167.     Credits:
  168.      Doug Downs (finally a local tracer!  found on PC-OHIO) got me
  169.     interested in uLathe (by Daniel S.    Baker CompuServe:  71551,2300)
  170.     which is a great (windows) modeler for lathing the objects.  I was
  171.     disappointed there was no way to export the data for ray tracing.
  172.     Appearantly I got wound up enough to write this package.  I'm into
  173.     POVRAY, but Doug is into Vivid ("Tastes great, Less filling").  Only
  174.     recently got Vivid running. Until then Doug provided the .V and the
  175.     testing.
  176.  
  177.    Revision History:
  178.    03-24-93 1.00 KJK  New. Inspired by uLathe.
  179.    03-28-93 1.01 KJK  Attempting Vivid output for Doug Downs.
  180.    04-11-93 1.10 KJK  Releasable Vivid output version.
  181.               Noticed THICK in Vivid not supported! Must fix.
  182.    04-11-93 1.11 KJK  Cured black speckles in POVRAY output.
  183.    04-14-93 1.12 KJK  Allow 0 length cones (rings) for Vivid.
  184.    04-15-93 1.13 KJK  Enable THICK for Vivid. Print line # of .DAT file for
  185.               each element.
  186.    04-24-93 1.20 KJK  Since they are necessary when thickness is used,
  187.               simulate cone/rings for POVRAY.
  188.